home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7868 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: wpb-105.magg.net!n4mwd
  2. From: n4mwd@magg.net (Dennis Hawkins)
  3. Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
  4. Subject: Re: Access carry flag from C
  5. Date: Mon, 19 Feb 1996 16:23:09
  6. Organization: M.A.G. Information Services (MAGG.NET)
  7. Message-ID: <n4mwd.40.0010633E@magg.net>
  8. References: <Dn1C9z.DGv.0.net@indra.com>
  9. NNTP-Posting-Host: wpb-105.magg.net
  10. X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
  11.  
  12. In article <Dn1C9z.DGv.0.net@indra.com> sullivan@indra.com (Steve Sullivan) writes:
  13.  
  14. >Is it possible to determine if a fixed point overflow has
  15. >occurred from within C?  For example:
  16. >   i = j + k;
  17. >   if (overflowed) ....;
  18.  
  19. If you are coding for a PC specific platform, you might be able to drop in 
  20. assembler mode and check the CARRY flag for certain mathmatical operations.  
  21. Not very portable, but I bet it would work.  For the example you gave, I would 
  22. probably write an inline macro in ASM and set it to load the carry flag into 
  23. a temp integer. Then the compare would work with the temp.  The macro 
  24. would have to be called immediately as all flags are extremely volitile.  
  25.  
  26.  
  27. Dennis Hawkins
  28. n4mwd@amsat.org
  29.  
  30. Vote YES for sci.agriculture.poultry!
  31.